<!DOCTYPE html>
<html>
<head>
	<title>演示页面</title>
	<meta charset="utf-8"/>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<style>
	html,body{height: 100%;font-size: 16px;}
	body{font-family: 'Microsoft Yahei';margin:0;padding:0;}
	.container {
		width: 1024px;
		margin: 0 auto;
	}
	</style>
</head>
<body>
	<div class="container">
		<h1>这是演示页</h1>
		<div>
			<iframe name="iframe" src="/?callback=callback&picscale=true&maxwidth=1440&maxheight=1080"></iframe>
			<div id="files"></div>
			<button onclick="allfiles()">列表文件名</button>
			<button onclick="downzip()">打包下载列表文件</button>
		</div>
	</div>
	<script>
		window.onload = function(){
			var src = document.getElementsByName("iframe")[0].src;
		 	var i = src.indexOf("?");
		 	if(i == -1) {
			 	src += Math.random();
		 	} else {
			 	src = src.substring(0, i + 1) + Math.random() + "&" + src.substring(i + 1);
		 	}
		};
		function callback(filename) {
			var a =  document.createElement("a");
			a.appendChild(document.createTextNode(filename));
			a.setAttribute("href", "/f/" + filename);
			a.setAttribute("target", "_blank");
			var file = document.createElement("div");
			file.appendChild(a);
			var files = document.getElementById("files");
			files.appendChild(file);
		}
		function allfiles() {
			var files = window.frames['iframe'].up.completednames;
			var text = "";
			for (var i = 0; i < files.length; i++) {
				text += files[i] + "\n";
			}
			alert(text);
		}
		function downzip() {
			var files = window.frames['iframe'].up.completednames;
			var url = "/f/zip/abc?";
			for (var i = 0; i < files.length; i++) {
				url += "filename=" + files[i] + "&";
			}
			url += Math.random();
			window.open(url);
		}
	</script>
	
</body>
</html>